package com.bi.bitest.bao.tasks;

import android.os.AsyncTask;
import android.util.Log;
import com.bi.bitest.bao.Client.ClientAPI;
import com.bi.bitest.bao.Constants;
import com.bi.bitest.bao.entity.discoverrecommend.DiscoverRecommendItem;
import com.bi.bitest.bao.utils.EntityParseUtil;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
 * Created
 * Author:bi[FR]
 * Date:15-10-20
 */
public class DiscoverRecommendTask extends BaseTask {

    public  DiscoverRecommendTask(TaskCallback callback){

        super(callback);
    }
    @Override
    protected TaskResult doInBackground(String... params) {
      TaskResult ret=new TaskResult();
           ret.action= Constants.TASK_ACTION_DISCOVER_RECOMMENDS;
        JSONObject jsonObject= ClientAPI.getDiscoverRecommend("and-f6",true,true);
       if(jsonObject!=null){
           try {
               ret.retCode=jsonObject.getInt("ret");
               ret.data= EntityParseUtil.parseDiscoverRecommends(jsonObject);
           } catch (JSONException e) {
               e.printStackTrace();
           }

       }


        return ret;
    }
}
